VERSION = '0.1.1'
APPNAME = 'webappi'

import os
import misc

# these variables are mandatory ('/' are converted automatically)
srcdir = '.'
blddir = 'build'

def set_options(opt):
	opt.tool_options('compiler_cc')

def configure(conf):
	conf.check_tool('compiler_cc cc vala')
	conf.check_cfg(package='glib-2.0', uselib_store='GLIB', atleast_version='2.10.0', mandatory=1, args='--cflags --libs')
	conf.check_cfg(package='gobject-2.0', uselib_store='GOBJECT', atleast_version='0.2200.3', mandatory=1, args='--cflags --libs')
	conf.check_cfg(package='libgscgi-1.0', uselib_store='GSCGI', atleast_version='0.1', mandatory=1, args='--cflags --libs')
	conf.check(fragment='#include <fastcgi.h>\nint main(){return 0;}\n', mandatory=1, msg='checking for libfcgi')

def build(bld):
	#generate a pkg-config description
	pcfile = bld.new_task_gen(features='subst')
	pcfile.source='webappi.pc.in'
	pcfile.target='webappi.pc'
	pcfile.dict={
               'NAME': 'webappi',
                'LIB': '-lwebappi',
	   'REQUIRES': 'glib-2.0 gobject-2.0',
             'PREFIX': bld.env['PREFIX'],
             'BINDIR': os.path.join("${prefix}", "bin"),
             'LIBDIR': os.path.join("${prefix}", "lib"),
         'INCLUDEDIR': os.path.join("${prefix}", "include", "webappi-0.1", "src"),
            'VERSION': VERSION,
	}
	bld.install_files(os.path.join(bld.env['PREFIX'], "lib", "pkgconfig"), pcfile.target)

	bld.add_subdirs('src')

